package com.ziq.base.transition

import android.os.Build
import android.transition.*
import android.view.Gravity
import android.view.View
import androidx.annotation.RequiresApi
import com.ziq.base.transition.custom.ChangeTextTransition

@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
class DefaultShareElementTransitionFactory : IShareElementTransitionFactory {
    override fun buildShareElementEnterTransition(): Transition {
        return buildShareElementsTransition()
    }

    override fun buildShareElementExitTransition(): Transition {
        return buildShareElementsTransition()
    }

    protected fun buildShareElementsTransition(): TransitionSet {
        val transitionSet = TransitionSet()
        transitionSet.addTransition(ChangeClipBounds())
        transitionSet.addTransition(ChangeTransform())
        transitionSet.addTransition(ChangeBounds())
        transitionSet.addTransition(ChangeImageTransform())

        transitionSet.addTransition(ChangeTextTransition())

        return transitionSet
    }

    override fun buildEnterTransition(): Transition {
        return Fade()
    }

    override fun buildExitTransition(): Transition {
        return Fade()
    }
}